<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>

<tal:block tal:repeat="users  getExpressions/result">
<div class="Expr">
<?php if($ctx->users['ExpressionsSent'][0]['read_status'] == 1 && ($ctx->type ==1 || $ctx->type ==4)) { $class="nor"; } else { $class="act"; } ?>
<div class="<?php echo $class;?>">
<?php if($ctx->type ==5) { ?>
<input type="checkbox" name="check_list[]" id="check_list" value="<?php echo $ctx->users['id']; ?>"/>
<?php }?>
<?php if($ctx->type ==6) { ?>
<input type="checkbox" name="check_list[]" id="check_list" value="<?php echo $ctx->users['user_id']; ?>"/>
<?php }?>
<?php if($ctx->type ==2 || $ctx->type ==3) { ?>
<?php $count = count($ctx->users['ExpressionsSent']);
if($count>1)
{
	$profPic = '/images/DefUser.gif';
	$otherCount = ($count-1);
	if($ctx->users['ExpressionsSent'][0]['receiver_id']!='')
	{
		
		$name = $ctx->users['ExpressionsSent'][0]['name'];
		
	} else {
		$name = $ctx->users['ExpressionsSent'][0]['receiver_email'];
	}
		$others =  'and '.$otherCount.' other(s)';
	//$count = 0;
} 
else 
{
	if($ctx->users['ExpressionsSent'][0]['photo']!='')
	{
		$profPic = '/Uploads/users/'.$ctx->users['ExpressionsSent'][0]['photo'];
	} else {
		$profPic = '/images/DefUser.gif';
	}
	if($ctx->users['ExpressionsSent'][0]['receiver_id']!='')
	{
		$name = $ctx->users['ExpressionsSent'][0]['name'];
	} else {
		$name = $ctx->users['ExpressionsSent'][0]['receiver_email'];
	}
	$others = '';
}
?>
<div class="blkCont">
<p class="UserImg"><img src="<?php echo $profPic;?>" height="45" width="45" /></p>
<p class="Date"><?php echo ago(strtotime($ctx->users['create_time']));?></p>
</div>
<div class="blkCont">
<div class="wid240">
<p class="UName"><a href="javascript:void(0);" onclick="javascript:alert('Profile page is in progress');"><?php echo $name;?></a>&nbsp;<?php echo $others;?></p>
<p class="Title"><a href="/expressions/index/view/<?php echo $ctx->type.'/'.base64_encode($ctx->getExpressions['currentPage']).'/'.base64_encode($ctx->users['id']); ?>"><span tal:content="structure php: this.SubStrText(users['subject'], 30)">Des Here</span></a></p>
<p class="Desc"><span tal:content="structure php: this.SubStrText(users['message'], 50)">Des Here</span></p>
<div>
<p><img src="/images/<?php echo $ctx->users['message_intensity']; ?>" title="<?php echo $ctx->users['desc']; ?>" /></p>
<!--<span style="margin:0;padding:0 8px;height:15px;width:50px;background-color:#"></span>-->
</div>
</div>
</div>

<?php } else if($ctx->type ==1 || $ctx->type ==4 || $ctx->type ==6 || $ctx->type ==5){
//echo '<pre>';print_r($ctx->users['ExpressionsSent']);exit;
  ?>
<?php if($ctx->users['anonymous']==1)
{
	$name = "Anonymous";
	$profPic = '/images/DefUser.gif';
} else {
	$name = $ctx->users['first_name'];
	if(isset($ctx->users['ExpressionsSent'][0]['UserDetails'][0]['photo']))
	{
	
		$profPic = "/Uploads/users/".$ctx->users['ExpressionsSent'][0]['UserDetails'][0]['photo'];
	} else {
		$profPic = '/images/DefUser.gif';
	}
}
?>
<div class="blkCont">
<p class="UserImg"><img src="<?php echo $profPic;?>" height="45" width="45" /></p>
<p class="Date"><?php echo ago(strtotime($ctx->users['create_time']));?></p>
</div>
<div class="blkCont">
<div class="wid240">
<p class="UName"><a href="javascript:void(0);" onclick="javascript:alert('Profile page is in progress');"><?php echo $name;?></a></p>
<p class="Title"><a href="/expressions/index/view/<?php echo $ctx->type.'/'.base64_encode($ctx->getExpressions['currentPage']).'/'.base64_encode($ctx->users['id']); ?>"><span tal:content="structure php: this.SubStrText(users['subject'], 30)">Des Here</span></a></p>

<p class="Title"><a href="#" onclick="getView('<?php echo $ctx->type?>','<?php echo base64_encode($ctx->getExpressions['currentPage']);?>','<?php echo base64_encode($ctx->users['id']);?>');">Click Here</a></p>

<p class="Desc"><span tal:content="structure php: this.SubStrText(users['message'], 50)">Des Here</span></p>
<div>
<p><img src="/images/<?php echo $ctx->users['message_intensity']; ?>" title="<?php echo $ctx->users['desc']; ?>" />

</p>
<!--<span style="margin:0;padding:0 8px;height:15px;width:50px;background-color:#"></span>-->
</div>
</div>
</div>
<?php } ?>

<div class="blkContRt">
<?php 
if($ctx->type==1){
		if(isset($ctx->users['MyFavorites']['status']))
		{
		$favorite_status = $ctx->users['MyFavorites']['status'];
		}
		else {
			$favorite_status = '';
			}
?>
<?php if($favorite_status=="Active"){?>
<a href="javascript:void(0);" onclick="changeStatusFavorite(<?php echo $ctx->users['id'];?>,'Inactive')"><img src="/images/FavorIconAct.png" alt="Favorite" title="Favorite" /></a>
<? } else {?>
<a href="javascript:void(0);" onclick="changeStatusFavorite(<?php echo $ctx->users['id'];?>,'Active')"><img src="/images/FavorIconNor.png" alt="Favorite" title="Favorite" /></a>
<? } ?>
<?php }?>
<?php if($ctx->users['attachment']) {?>
<span><a href="/expressions/index/view/<?php echo $ctx->type.'/'.base64_encode($ctx->getExpressions['currentPage']).'/'.base64_encode($ctx->users['id']); ?>"><img src="/images/AttachIcon.gif" alt="Attachment" border="0" title="Attachment" /></a></span>
<?php } ?>
<?php if($ctx->type == 1 && $ctx->users['anonymous']==0){ ?>
<span><a href="javascript:void(0);" onclick="changeStatustoClose(<?php echo $ctx->users['user_id'];?>,'block');"><img src="/images/BlockIcon.png" alt="Block" border="0" class="img_inline" title="Block" /></a></span>
 <?php } ?>
<span><a href="javascript:void(0);" onclick="changeStatustoClose(<?php echo $ctx->users['id'];?>,'close');"><img src="/images/CloseIcon.png" alt="Close" border="0" class="img_inline" title="Delete"/></a></span>
</div>

<div class="clear"></div>
</div>
<div class="clear"></div>
</div></tal:block>

<div class="log"></div>

<script type="text/javascript">
//<![CDATA[
function closeDiv() {
	$("#right_block").show();
	$("#left_block").removeClass("ModuleBlock ListWidMin").addClass("ModuleBlock ListWid");
	$("#msg_view").hide(600);
}
function getView(type, id, page)
{	
	var options = {};	
	$.ajax({
			   type: "POST",
			   dataType: "json",
			   url: "/expressions/index/viewajax/"+type+'/'+id+'/'+page,
			    success: function(data){	
					$("#right_block").hide();
					$('#msg_view').html(data.output);
					$("#left_block").removeClass("ModuleBlock ListWid").addClass("ModuleBlock ListWidMin");
					//$( "#effect" ).toggle( selectedEffect, options, 500 );
					//$("#msg_view").show("pulsate", {}, 1000);
					$("#msg_view").show(600);
				}
			});
}

function changeStatustoBlock(val)
{
	alert(val);return false;
	$.ajax({
			   type: "POST",
			   //dataType: "json",
			   data: "val="+val,
			   url: "/producerlist/index/getproductsectors/",
			    success: function(data){
					$('#selectdata').html(data);
					
				}
			});
}

function changeStatustoClose(val,action)
{
//alert(val+"   "+action);return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
			   data: "val="+val+"&tpye="+action+"&msgType=<?php echo $ctx->type;?>",
			   url: "/expressions/index/change-status/",
			    success: function(data){
					location.reload();					
				}
			});
}
//]]>
</script>


